package com.tedu.demo1;

import java.util.Random;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        int[] balls = caipiao(7);
        for (int i = 0; i < 7; i++) {
            System.out.println(balls[i]);
        }
        int[] balls2=inputUserNumbers(7);
        boolean res=compareTwoArray(balls,balls2);
        System.out.println(res?"中奖了":"没中奖");
    }

    static int[] caipiao(int len) {
        int[] balls = new int[len];
        for (int i = 0; i < 6; i++) {
            balls[i] = (int) (Math.random() * 33);
        }
        balls[balls.length - 1] = (int) (Math.random() * 16);
        return balls;
    }



    private static boolean compareTwoArray(int[] balls, int[] balls2) {
        boolean res = true;
        for(int i = 0;i<7;i++){
            if(balls[i] == balls2[i]){
                res = true;
            }else{
                res = false;
            }
        }
        return res;
    }

    private static int[] inputUserNumbers(int i) {
        Scanner random = new Scanner(System.in);
        int[] array = new int[i];
        for (int j = 0; j < 7; j++) {
            array[j] = random.nextInt();
        }
        return array;
    }
}
